
import service from "@/api/index.js";
//将所有的针对admin的请求都封装到一个对象中
const memberApi = {
    /*分页获取所有会员信息*/
    getAllMember(params){
        return service.get('/member',{params}).then(response=>response.data)
    },
    getAllMembers(){
        return service.get('/member/getAll').then(response=>response.data)
    },
    /*校验名称*/
    checkName(name){
        return service.get('/member/checkName',{params:{name:name}}).then(response=>response.data)
    },
    /*校验手机号*/
    checkPhone(phone){
        return service.get('/member/checkPhone',{params:{phone:phone}}).then(resp=>resp.data)
    },
    /*添加会员*/
    addMember(member){
        return service.post('/member',member).then(resp=>resp.data)
    },
    /*编辑*/
    editMember(member){
        return service.post('/member/editMember',member).then(resp=>resp.data)
    },
    /*删除会员*/
    remove(id){
        return service.get('/member/remove',{params:{id:id}}).then(resp=>resp.data)
    },
    /*批量删除*/
    delSelected(ids){
        return service.post('/member/delSelected',ids).then(resp=>resp.data)
    },
    /*充值*/
    pay(balance,memberId){
        return service.get('/member/pay',{params:{balance:balance,memberId:memberId}}).then(resp=>resp.data)
    },
    /*消费*/
    consume(balance,memberId){
        return service.get('/member/consume',{params:{balance:balance,memberId:memberId}}).then(resp=>resp.data)
    }
}
export default memberApi;